<template>
	<div v-cloak class="aui-wrapper aui-page__iframe">
		<div class="aui-content__wrapper">
			<div class="aui-content">
				<el-card shadow="never" class="aui-card--fill">
					<div class="mod-lswms__trade">
						<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
							<el-row>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.tradetype" size="small" placeholder="交易类型"
											clearable></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.sku" size="small" placeholder="物料" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.qty" size="small" placeholder="数量" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.fromlot" size="small" placeholder="自批" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.tolot" size="small" placeholder="至批" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.fromlocation" size="small" placeholder="自库位"
											clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.tolocation" size="small" placeholder="至库位"
											clearable></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.fromtray" size="small" placeholder="自箱" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.totray" size="small" placeholder="至箱" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.frombox" size="small" placeholder="自格" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-input v-model="dataForm.tobox" size="small" placeholder="至格" clearable>
										</el-input>
									</el-form-item>
								</el-col>
								<el-col :span="2">
									<el-form-item>
										<el-button size="small" @click="getDataList()">查询</el-button>
									</el-form-item>
								</el-col>

							</el-row>
							<!-- <el-form-item>
								<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
							</el-form-item>
							<el-form-item>
								<el-button type="danger" @click="deleteHandle()">删除</el-button>
							</el-form-item>
							<el-form-item>
								<el-button type="info" @click="exportHandle()">导出</el-button>
							</el-form-item> -->
						</el-form>
						<el-table v-loading="dataListLoading" :data="dataList" border
							@selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle"
							style="width: 100%;" >
							<!-- <el-table-column type="selection" header-align="center" align="center" width="50">
							</el-table-column>
							<el-table-column prop="id" label="序号" header-align="center" align="center">
							</el-table-column> -->
							<el-table-column prop="addtime" label="创建时间" header-align="center" align="center"
								width="160px" fixed>
							</el-table-column>
							<!-- <el-table-column prop="tradekey" label="交易号" header-align="center" align="center">
							</el-table-column> -->
							<el-table-column prop="tradetype" label="交易类型" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="sku" label="物料" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="qty" label="数量" header-align="center" align="center">
							</el-table-column>

							<el-table-column prop="fromlot" label="自批" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot" label="至批" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlocation" label="自库位" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolocation" label="至库位" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromtray" label="自箱" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="totray" label="至箱" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="frombox" label="自格" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tobox" label="至格" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="sourcetype" label="来源单类型" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="sourcekey" label="来源单号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="sourceline" label="来源单行号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="sourcelinelist" label="来源单记录行号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot1" label="自生产日期" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot2" label="自有效日期" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot3" label="自是否加长" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot4" label="自价格" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot5" label="自部门/供应商" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot6" label="自计划单号/工序号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot7" label="自主制车间" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot8" label="任务编码" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot9" label="自新旧" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot10" label="自作废" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot11" label="自炉批号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot12" label="自材料复验号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot13" label="自牌号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot14" label="自属性14" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="fromlot15" label="自属性15" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot1" label="至生产日期" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot2" label="至有效日期" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot3" label="至是否加长" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot4" label="至价格" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot5" label="至部门/供应商" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot6" label="至计划单号/工序号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot7" label="至主制车间" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot8" label="至任务编码" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot9" label="至新旧" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot10" label="至作废" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot11" label="至炉批号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot12" label="至材料复验号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot13" label="至牌号" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot14" label="至属性14" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="tolot15" label="至属性15" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="status" label="状态" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="remark" label="备注" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="adduser" label="创建人" header-align="center" align="center">
							</el-table-column>

							<!-- <el-table-column prop="updatuser" label="更新人" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="updatetime" label="更新时间" header-align="center" align="center">
							</el-table-column> -->
							<!-- <el-table-column label='操作' fixed="right" header-align="center" align="center" width="150">
								<template #default="scope">
									<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改
									</el-button>
									<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除
									</el-button>
								</template>
							</el-table-column> -->
						</el-table>
						<el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit"
							:total="total" layout="total, sizes, prev, pager, next, jumper"
							@size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle">
						</el-pagination>
						<!-- 弹窗, 新增 / 修改 -->
						<tradeAddOrUpdate v-if="addOrUpdateVisible" ref="addOrUpdate" @refresh-data-list="getDataList">
						</tradeAddOrUpdate>
					</div>
				</el-card>
			</div>
		</div>
	</div>
</template>

<script>
	import DataList from "@/utils/DataList";
	import {
		ref,
		reactive,
		onMounted,
		nextTick
	} from 'vue';
	import tradeAddOrUpdate from "@/components/lswms/stock/TradeAddOrUpdate";

	//import {hasPermission} from "@/utils/hasPermission"
	export default {
		name: "trade",

		components: {
			tradeAddOrUpdate,
		},

		setup() {
			const {
				dataForm,
				mixinViewModuleOptions,
				getDataList,
				dataList,
				total,
				page,
				limit,
				dataListLoading,
				dataListSelectionChangeHandle,
				dataListSortChangeHandle,
				pageSizeChangeHandle,
				pageCurrentChangeHandle,
				addOrUpdateHandle,
				deleteHandle,
				exportHandle,
				addOrUpdateVisible,
				dataListSelections,
				addOrUpdate
			} = DataList();

			onMounted(() => {
				mixinViewModuleOptions.value.getDataListIsPage = true;
				mixinViewModuleOptions.value.getDataListURL = '/lswms/trade/page';
				mixinViewModuleOptions.value.deleteURL = '/lswms/trade';
				mixinViewModuleOptions.value.exportURL = '/lswms/trade/export';
				mixinViewModuleOptions.value.deleteIsBatchKey = 'id';
				mixinViewModuleOptions.value.deleteIsBatch = true
				if (mixinViewModuleOptions.value.activatedIsNeed) {
					getDataList();
				}

			})

			return {
				dataForm,
				mixinViewModuleOptions,
				getDataList,
				dataList,
				total,
				page,
				limit,
				dataListLoading,
				dataListSelectionChangeHandle,
				dataListSortChangeHandle,
				pageSizeChangeHandle,
				pageCurrentChangeHandle,
				addOrUpdateHandle,
				deleteHandle,
				exportHandle,
				addOrUpdateVisible,
				dataListSelections,
				addOrUpdate,
			}
		},
		// methods:{
		//      hasPermission
		// }
	}
</script>

<style scoped>

</style>
